using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Box2D.XNA;
using Spinning.Spinning.Interface;
using Spinning.Spinning.Entity;
using Microsoft.Xna.Framework;

namespace Spinning.Spinning.Unitity
{
    class PhysicConnector : IUpdateHandler
    {
        public Body Body{get;private set;}
        public Sprite Actor { get; private set; }

        public PhysicConnector(Sprite sprite, Body body)
        {
            this.Actor = sprite;
            this.Body = body;
            Actor.Origin = new Vector2(0.5f);
        }

        public void OnUpdate(GameTime gameTime) {
            float r = Body.Rotation;
            Vector2 pos = Functional.Vector2InScene(Body.Position);
            Actor.Rotation = r;
            Actor.Position = pos;
        }

    }
}
